home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-12-05 | 2.5 KB | 59 lines | [TEXT/R*ch] |
- /* The Swarm.h -- type definitions & other header file stuff.
- */
-
- // Include file for the GWorld offscreen drawing stuff.
- #include <QDoffscreen.h>
-
-
- // Data structures
- typedef short **ShortHandle; // Our Bee position arrays will be dynamic arrays
- // allocated using handles.
-
- typedef struct // All data we use is stored in this struct.
- {
- short queenX[2], queenY[2]; // Storage for Queen line segment.
- short queenVelocityX, queenVelocityY; // Current Queen velocity components.
- ShortHandle beeX[2], beeY[2]; // Bee line segments.
- ShortHandle beeVelocityX, beeVelocityY; // Bee velocities components.
-
- Rect swarmRect; // Bounding rectangle for swarm at time '0'.
- Rect oldRect; // Bounding rectangle for swarm at time '1'.
-
- short maxQueenVelocity, maxBeeVelocity; // These variables store the constants
- short maxQueenAcceleration, maxBeeAcceleration; // defined earlier.
- short border; //
-
- short nBees; // The current number of active Bees.
-
- long delay; // The current animation speed depends on this value.
- long startDrawing; // Works together with delay to control animation speed.
-
- long switchColor; // The current bee color-changing speed depends on this value.
- long colStepCnt; // Counter to 'count-up' until switchColor.
- long colDirection; // Controls the direction of the bee color changes.
- long colIndex; // CLUT index for the current bee color.
-
- Boolean demoMode; // Are we currently in After Dark demo Mode?
- Boolean doFade; // Should we do a smooth fade?
-
- RGBColor whiteRGB, blackRGB; // Color QuickDraw colors: white and black.
- RGBColor queenRGB, beeRGB; // Color QuickDraw colors for Queen and Bees.
- RGBColor backRGB; // Color QuickDraw color for animation background.
-
- Rect monitorRect; // Rectangle corresponding to main monitor.
- short winW, winH; // The info about monitorRect we really need.
-
- GWorldPtr gMyOffG; // A pointer to an offscreen graphics world.
- }
- TSwarmData, *TSwarmDataPtr;
-
- // A comment about this 'time t' business: each swarm member's
- // line segment is drawn 'from' position 0 to position 1. So
- // t=1 is the 'old' position, t=0 the 'new' position. After one
- // frame of animation, e.g. QX(0) will be assigned to QX(1) (making
- // that the 'old' position), and QX[0] will get a new value. In other
- // words, every swarm creature essentially traces a continuous path
- // across the screen.
-
-
-